
const mongoose = require('mongoose');

const orderSchema = new mongoose.Schema({
    userId: {
        type: mongoose.Schema.Types.ObjectId,
        ref: "shop-users"
    }, //用户 id
    shopId: {
        type: mongoose.Schema.Types.ObjectId,
        ref: "shop-stores"
    }, //门店 id
    distributionId: {
        type: mongoose.Schema.Types.ObjectId,
        ref: "shop-distribution"
    }, //配送人员 id
    time: String, //下单时间
    state: Boolean, //订单状态(已完成、进行中)
    price: String,
    goodsArr: Array,
});

mongoose.model('shop-orders', orderSchema, "shop-orders");
